
from multiprocessing import Process, Manager
def run(q):
    q.put(1)
    q.put(2)
    q.put(3)
    pass

if __name__ == '__main__':
    queue = Manager().Queue()
    p = Process(target=run, args=(queue,))
    p.start()
    p.join()
    print(queue.get())
    print(queue.get())
    print(queue.get()) # 如果队列中没有值会阻塞
    print(queue.get(tiemout=3)) # 阻塞3秒后抛出异常